﻿#pragma once


#include <QDialog>
#include <QPushButton>
#include "QListView"
#include "QStringListModel"
#include "QFileDialog"
#include "QMessageBox"
#include "QApplication"
#include "QVBoxLayout"
#include <QDesktopWidget>
#include <QLibrary>
#include <QApplication>
#include <QLabel>
#include <QComboBox>
#include "QListView"
#include "QStringListModel"
#include "QLineEdit"
#include "QSpinBox"
#include <QSettings>

#include "commonfunction.h"

#include "halcon_opencv.h"

using namespace std;

#include "qt_graphics_view.h"






//#include <fstream>
//#include "nlohmann/json.hpp"
//using json = nlohmann::json;
//QSettings* m_qsettings;

class FunctionSegmentCircle :public QDialog
{
public:
	QtQGraphicsView* m_view;
	QLabel* m_view_pixel_qlabel;

    QSettings* m_qsettings;
    Mat m_image ,m_image_show;
    QString m_section   = "";

    QLabel* m_qlabel_inner_radius;
    QSpinBox* m_qspinbox_inner_radius;
    int m_inner_radius=10000;

    QLabel* m_qlabel_outer_radius;
    QSpinBox* m_qspinbox_outer_radius;
    int m_outer_radius;

	QPushButton* m_pushbutton_show_orign_image;
    QPushButton* m_pushbutton_detection;
    QPushButton* m_pushbutton_save_parameter;
    QPushButton* m_pushbutton_return;
    QPushButton* m_pushbutton_dir_crop;

    HObject image_crop;

    HObject image_in;
public:
    explicit FunctionSegmentCircle(QDialog *parent = nullptr, QSettings* qsettings = nullptr,QString section="") ;
    ~FunctionSegmentCircle() ;
    virtual void detectionImage();
    virtual bool detection( HObject image_in, QString& message);
    virtual void draw( Mat image_in,Mat& image_out);
    virtual void loadParameter();
    virtual void saveParameter();
    virtual bool showDialog();
};
#pragma execution_character_set("utf-8")
